﻿using System;
using System.Collections;
using mojoPortal.Web.Framework;

namespace ud_GoldWeatherEtc
{
    /// <summary>
    /// encapsulates the feature instance configuration loaded from module settings into a more friendly object
    /// </summary>
    public class GoldWeatherEtcConfiguration
    {
        public GoldWeatherEtcConfiguration()
        { }

        public GoldWeatherEtcConfiguration(Hashtable settings)
        {
            LoadSettings(settings);

        }

        private void LoadSettings(Hashtable settings)
        {
            if (settings == null) { throw new ArgumentException("must pass in a hashtable of settings"); }

            if (settings.Contains("CustomCssClassSetting"))
            {
                customCssClass = settings["CustomCssClassSetting"].ToString();
            }
            showWeather = WebUtils.ParseBoolFromHashtable(settings, "ShowWeatherSetting", showWeather);
            showGold = WebUtils.ParseBoolFromHashtable(settings, "ShowGoldSetting", showGold);
            showRate = WebUtils.ParseBoolFromHashtable(settings, "ShowRateSetting", showRate);
            showRateCompact = WebUtils.ParseBoolFromHashtable(settings, "ShowRateCompactSetting", showRateCompact);
        }

        private string customCssClass = string.Empty;
        public string CustomCssClass { get { return customCssClass; } }

        private bool showWeather;
        public bool ShowWeather { get { return showWeather; } }

        private bool showGold;
        public bool ShowGold { get { return showGold; } }

        private bool showRate;
        public bool ShowRate { get { return showRate; } }

        private bool showRateCompact;
        public bool ShowRateCompact { get { return showRateCompact; } }

    }
}